<?php
/**
 * Created by b17
 * 3/5/12 9:29 PM
 */

namespace G4T\Api\Weather;

class Google
{
    private $_client;

    public function __construct($city)
    {
        $this->_client = new \Zend_Http_Client('http://www.google.com/ig/api');
        $this->_client->setParameterGet('weather', $city);
        $this->_client->setParameterGet('hl', 'ru');
        $this->_client->setParameterGet('ie', 'utf-8');
        $this->_client->setParameterGet('oe', 'utf-8');
    }

    public function getForecast()
    {
        $response = $this->_client->request(\Zend_Http_Client::GET);
        $xml = $response->getBody();

        return simplexml_load_string($xml);
    }

}
